public static int s_icurrentIGMPos=0;
int iItemIGM=0;
public static boolean isIGMenu=false;
public static String[] astrIGMMenuItem = {"RESUME", "OPTIONS","HELP","HIGH SCORE","ABOUT","EXIT"};
public static Image m_imgIGMenuBG;
// Image m_imgIGMMenuSprite;
// public static Sprite m_SprConvatchuyendongIGM;
//public static int s_control=5;
// public static int s_AniPositionxIGM;
// public static int s_AniDirectionIGM;
// int[] arrSequenceLeftIGM  = {4,4,4,4,4,4,5,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,};
// int[] arrSequenceRightIGM = {8,8,8,8,8,8,9,9,9,9,9,9,10,10,10,10,10,11,11,11,11,11,};
// int[] arrSequenceDownIGM=  {0,0,0,0,0,1,1,1,1,1,2,2,2,2,2,3,3,3,3,3};
// int[] arrSequenceUpIGM =	 {12,12,12,12,12,13,13,13,13,13,14,14,14,14,14,15,15,15,15,15,};


void Select_IGMenu()
{
	switch (s_icurrentIGMPos)
	{
		case 0: SwitchState2(GameState.InGame);  break;
		case 1: SwitchState(GameState.Options);break;
		case 2: SwitchState(GameState.Help);break;
		case 3: SwitchState(GameState.HighScore); break;
		case 4: SwitchState(GameState.About); break;
		case 5: SwitchState(GameState.Exit);break;
	}
}

void UpdateIGMenu(int mode)
{
	if (mode == UpdateType.UPDATE)
	{
		//System.out.println("**********MODE UPDATE*************");
		if (IsKeyPressed(GK_DOWN)) {
			//m_SprConvatchuyendongIGM.setFrameSequence(arrSequenceDown);
			if (++s_icurrentIGMPos > 5) s_icurrentIGMPos = 0;
		}
		else if (IsKeyPressed(GK_UP)) {
			//m_SprConvatchuyendongIGM.setFrameSequence(arrSequenceUp);
			
			if (--s_icurrentIGMPos < 0) s_icurrentIGMPos = 5;
		}
		else if (IsKeyPressed(GK_SELECT))
			Select_IGMenu();
 		// else if (IsKeyPressed(GK_LEFT)) {
			// s_AniDirectionIGM = 4;
			//m_SprConvatchuyendongIGM.setFrameSequence(arrSequenceLeft);
			//m_SprConvatchuyendongIGM.move(-4, 0);
			//s_AniPositionx+=5;
		// }
		// else if (IsKeyPressed(GK_RIGHT))
		// {
			// s_AniDirectionIGM = 2;
			// m_SprConvatchuyendongIGM.setFrameSequence(arrSequenceRight);
			// m_SprConvatchuyendongIGM.move(+4, 0);
			//s_AniPositionx-=5;
		// }		
			
	} //end of Update mode
	
	if (mode == UpdateType.PAINT)
	{
		if (m_imgIGMenuBG != null)
		{
			s_g.drawImage(m_imgIGMenuBG, 0, 0, Graphics.TOP|Graphics.LEFT);
		}
		// draw menu item bg
		for (iItemIGM = 0; iItemIGM < 6; iItemIGM++) {
			// if (iItem == s_icurrentMenuPos) s_g.setColor(0x2582A7); 
			// else s_g.setColor(c_white);
			// s_g.setFont(Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_BOLD, Font.SIZE_LARGE));
			
			// drawString(s_g, astrMenuItem[iItem], 0, SCREEN_W/2, 65 + 33 * iItem, 1);
			if(iItemIGM==s_icurrentIGMPos)
			fonts[1].drawString(astrIGMMenuItem[iItemIGM],SCREEN_W>>1,60 + 33 * iItemIGM,Graphics.HCENTER,s_g);
			else fonts[2].drawString(astrIGMMenuItem[iItemIGM],SCREEN_W>>1,60 + 33 * iItemIGM,Graphics.HCENTER,s_g);
			
		}
		int titleW=0;
		for (int i = 0; i < 3; i++)
		{
		    titleW = fonts[1].stringWidth(astrIGMMenuItem[s_icurrentIGMPos]);
			sprArrow.paintAnim(s_g, 0, s_frameCount, (SCREEN_W>>1)
					+ (titleW >> 1) + 3, 62+33*s_icurrentIGMPos);
			sprArrow.paintAnim(s_g, 1, s_frameCount, (SCREEN_W>>1)
					- (titleW >> 1) - 17, 62+33*s_icurrentIGMPos);
		}
		// Draw the identified animated icon
		// if (m_imgIGMMenuSprite != null)
		// {				
			// try{						
				// m_SprConvatchuyendongIGM.setPosition(SCREEN_W - s_AniPositionxIGM, 30+33*s_icurrentIGMPos);
			// }catch(Exception e)
			// {
				// System.out.println("Co ngoai le****%(*%&%*(%&*%");
			// }
			
		// }
		
		// if(m_SprConvatchuyendongIGM!=null)
		// {
			// m_SprConvatchuyendongIGM.paint(s_g);		
			// m_SprConvatchuyendongIGM.nextFrame();
		// } 
		
	}
	
	if (mode == UpdateType.CTOR)
	{   s_keyPressed=0;
		// life=3;
		iItemIGM=0;
		isIGMenu=false;
		try
		{
			m_imgIGMenuBG = Image.createImage("/background1.png");	
            sprArrow = new XSprite("/arrow.png", 12, 16, new byte[][] {
				{ 0, 1, 2, 1 }, { 3, 4, 5, 4 } });			
			// m_imgIGMMenuSprite	= Image.createImage("/monter_strip16.png");		
			
			// m_SprConvatchuyendongIGM = new Sprite(m_imgIGMMenuSprite, 60, 57);
			// m_SprConvatchuyendongIGM.setFrameSequence(arrSequenceLeft);
			
			// initFontSystem();
			// s_AniPositionxIGM = 40;	
			
		} 
		catch (Exception e)
		{
			System.out.println("e:::::::::Khong tim thay hinh:::::::: " + e.getMessage());
		}
	}
	if (mode == UpdateType.DTOR)
	{
	 s_keyPressed=0;
	 m_imgIGMenuBG=null;
	 sprArrow=null;
	 isIGMenu=true;
	 // m_imgIGMMenuSprite=null;
	 // m_SprConvatchuyendongIGM=null;
	}
	
}
// NOT YET RESOLVED: TWO EXCEPTION WHEN LOAD FONT AND DRAW STRING, SEE IN CFont.h for more detail
